﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using BOHVote.BLL;
using BOHVote.Entity;
 

namespace BOH.Reports
{
    public partial class AllHeighApplyReport : System.Web.UI.Page
    {
        private BHUser user;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["User"] != null)
            {
                user = (BHUser)Session["User"];
            }
            if (!IsPostBack)
            {
                if (user != null)
                {
                    if (user.RightType == "S")
                    {
                        SubjectBindID(user.RightCode);
                    }
                    else
                    {
                        SubjectBindID("");
                    }
                }
                //BindSubject();
            }
        }

        public void BindSubject()
        {
            DataSet dst = Subject.getAllASubject();
            foreach (DataRow dr in dst.Tables[0].Rows)
            {
                ListItem li = new ListItem(dr["subjectName"].ToString(), dr["subjectID"].ToString());
                this.drpSubject.Items.Add(li);
            }
        }

        public void SubjectBindID(string SubjectID)
        {
            this.drpSubject.Items.Clear();
            //ListItem li1 = new ListItem("请选择学科组", "-1");
            //this.drpSubject.Items.Add(li1);
            if (String.IsNullOrEmpty(SubjectID))
            {
                DataSet dst = Subject.getAllASubject();

                foreach (DataRow dr in dst.Tables[0].Rows)
                {
                    if (dr["SubjectID"].ToString().Length > 0)
                    {
                        ListItem li = new ListItem(dr["SubjectName"].ToString(), dr["SubjectID"].ToString());
                        this.drpSubject.Items.Add(li);
                    }
                }
            }
            else
            {
                string SubjectName = Subject.getSubjectNameBySubjectID(SubjectID);
                ListItem li = new ListItem(SubjectName, SubjectID);
                this.drpSubject.Items.Add(li);
            }
        }
    }
}
